function InfoBox(opt_opts){
opt_opts=opt_opts||{};
google.maps.OverlayView.apply(this, arguments);
this.content_=opt_opts.content||"";
this.disableAutoPan_=opt_opts.disableAutoPan||false;
this.maxWidth_=opt_opts.maxWidth||0;
this.pixelOffset_=opt_opts.pixelOffset||new google.maps.Size(0, 0);
this.position_=opt_opts.position||new google.maps.LatLng(0, 0);
this.zIndex_=opt_opts.zIndex||null;
this.boxClass_=opt_opts.boxClass||"infoBox";
this.boxStyle_=opt_opts.boxStyle||{};
this.closeBoxMargin_=opt_opts.closeBoxMargin||"2px";
this.closeBoxURL_=opt_opts.closeBoxURL||"http://www.google.com/intl/en_us/mapfiles/close.gif";
if(opt_opts.closeBoxURL===""){
this.closeBoxURL_="";
}
this.infoBoxClearance_=opt_opts.infoBoxClearance||new google.maps.Size(1, 1);
if(typeof opt_opts.visible==="undefined"){
if(typeof opt_opts.isHidden==="undefined"){
opt_opts.visible=true;
}else{
opt_opts.visible = !opt_opts.isHidden;
}}
this.isHidden_ = !opt_opts.visible;
this.alignBottom_=opt_opts.alignBottom||false;
this.pane_=opt_opts.pane||"floatPane";
this.enableEventPropagation_=opt_opts.enableEventPropagation||false;
this.div_=null;
this.closeListener_=null;
this.moveListener_=null;
this.contextListener_=null;
this.eventListeners_=null;
this.fixedWidthSet_=null;
}
InfoBox.prototype=new google.maps.OverlayView();
InfoBox.prototype.createInfoBoxDiv_=function (){
var i;
var events;
var bw;
var me=this;
var cancelHandler=function (e){
e.cancelBubble=true;
if(e.stopPropagation){
e.stopPropagation();
}};
var ignoreHandler=function (e){
e.returnValue=false;
if(e.preventDefault){
e.preventDefault();
}
if(!me.enableEventPropagation_){
cancelHandler(e);
}};
if(!this.div_){
this.div_=document.createElement("div");
this.setBoxStyle_();
if(typeof this.content_.nodeType==="undefined"){
this.div_.innerHTML=this.getCloseBoxImg_() + this.content_;
}else{
this.div_.innerHTML=this.getCloseBoxImg_();
this.div_.appendChild(this.content_);
}
this.getPanes()[this.pane_].appendChild(this.div_);
this.addClickHandler_();
if(this.div_.style.width){
this.fixedWidthSet_=true;
}else{
if(this.maxWidth_!==0&&this.div_.offsetWidth > this.maxWidth_){
this.div_.style.width=this.maxWidth_;
this.div_.style.overflow="auto";
this.fixedWidthSet_=true;
}else{
bw=this.getBoxWidths_();
this.div_.style.width=(this.div_.offsetWidth - bw.left - bw.right) + "px";
this.fixedWidthSet_=false;
}}
this.panBox_(this.disableAutoPan_);
if(!this.enableEventPropagation_){
this.eventListeners_=[];
events=["mousedown", "mouseover", "mouseout", "mouseup",
"click", "dblclick", "touchstart", "touchend", "touchmove"];
for (i=0; i < events.length; i++){
this.eventListeners_.push(google.maps.event.addDomListener(this.div_, events[i], cancelHandler));
}
this.eventListeners_.push(google.maps.event.addDomListener(this.div_, "mouseover", function (e){
this.style.cursor="default";
}));
}
this.contextListener_=google.maps.event.addDomListener(this.div_, "contextmenu", ignoreHandler);
google.maps.event.trigger(this, "domready");
}};
InfoBox.prototype.getCloseBoxImg_=function (){
var img="";
if(this.closeBoxURL_!==""){
img="";
}
return img;
};
InfoBox.prototype.addClickHandler_=function (){
var closeBox;
if(this.closeBoxURL_!==""){
closeBox=this.div_.firstChild;
this.closeListener_=google.maps.event.addDomListener(closeBox, "click", this.getCloseClickHandler_());
}else{
this.closeListener_=null;
}};
InfoBox.prototype.getCloseClickHandler_=function (){
var me=this;
return function (e){
e.cancelBubble=true;
if(e.stopPropagation){
e.stopPropagation();
}
google.maps.event.trigger(me, "closeclick");
me.close();
};};
InfoBox.prototype.panBox_=function (disablePan){
var map;
var bounds;
var xOffset=0, yOffset=0;
if(!disablePan){
map=this.getMap();
if(map instanceof google.maps.Map){
if(!map.getBounds().contains(this.position_)){
map.setCenter(this.position_);
}
bounds=map.getBounds();
var mapDiv=map.getDiv();
var mapWidth=mapDiv.offsetWidth;
var mapHeight=mapDiv.offsetHeight;
var iwOffsetX=this.pixelOffset_.width;
var iwOffsetY=this.pixelOffset_.height;
var iwWidth=this.div_.offsetWidth;
var iwHeight=this.div_.offsetHeight;
var padX=this.infoBoxClearance_.width;
var padY=this.infoBoxClearance_.height;
var pixPosition=this.getProjection().fromLatLngToContainerPixel(this.position_);
if(pixPosition.x < (-iwOffsetX + padX)){
xOffset=pixPosition.x + iwOffsetX - padX;
}else if((pixPosition.x + iwWidth + iwOffsetX + padX) > mapWidth){
xOffset=pixPosition.x + iwWidth + iwOffsetX + padX - mapWidth;
}
if(this.alignBottom_){
if(pixPosition.y < (-iwOffsetY + padY + iwHeight)){
yOffset=pixPosition.y + iwOffsetY - padY - iwHeight;
}else if((pixPosition.y + iwOffsetY + padY) > mapHeight){
yOffset=pixPosition.y + iwOffsetY + padY - mapHeight;
}}else{
if(pixPosition.y < (-iwOffsetY + padY)){
yOffset=pixPosition.y + iwOffsetY - padY;
}else if((pixPosition.y + iwHeight + iwOffsetY + padY) > mapHeight){
yOffset=pixPosition.y + iwHeight + iwOffsetY + padY - mapHeight;
}}
if(!(xOffset===0&&yOffset===0)){
var c=map.getCenter();
map.panBy(xOffset, yOffset);
}}
}};
InfoBox.prototype.setBoxStyle_=function (){
var i, boxStyle;
if(this.div_){
this.div_.className=this.boxClass_;
this.div_.style.cssText="";
boxStyle=this.boxStyle_;
for (i in boxStyle){
if(boxStyle.hasOwnProperty(i)){
this.div_.style[i]=boxStyle[i];
}}
this.div_.style.WebkitTransform="translateZ(0)";
if(typeof this.div_.style.opacity!=="undefined"&&this.div_.style.opacity!==""){
this.div_.style.MsFilter="\"progid:DXImageTransform.Microsoft.Alpha(Opacity=" + (this.div_.style.opacity * 100) + ")\"";
this.div_.style.filter="alpha(opacity=" + (this.div_.style.opacity * 100) + ")";
}
this.div_.style.position="absolute";
this.div_.style.visibility='hidden';
if(this.zIndex_!==null){
this.div_.style.zIndex=this.zIndex_;
}}
};
InfoBox.prototype.getBoxWidths_=function (){
var computedStyle;
var bw={top: 0, bottom: 0, left: 0, right: 0};
var box=this.div_;
if(document.defaultView&&document.defaultView.getComputedStyle){
computedStyle=box.ownerDocument.defaultView.getComputedStyle(box, "");
if(computedStyle){
bw.top=parseInt(computedStyle.borderTopWidth, 10)||0;
bw.bottom=parseInt(computedStyle.borderBottomWidth, 10)||0;
bw.left=parseInt(computedStyle.borderLeftWidth, 10)||0;
bw.right=parseInt(computedStyle.borderRightWidth, 10)||0;
}}else if(document.documentElement.currentStyle){
if(box.currentStyle){
bw.top=parseInt(box.currentStyle.borderTopWidth, 10)||0;
bw.bottom=parseInt(box.currentStyle.borderBottomWidth, 10)||0;
bw.left=parseInt(box.currentStyle.borderLeftWidth, 10)||0;
bw.right=parseInt(box.currentStyle.borderRightWidth, 10)||0;
}}
return bw;
};
InfoBox.prototype.onRemove=function (){
if(this.div_){
this.div_.parentNode.removeChild(this.div_);
this.div_=null;
}};
InfoBox.prototype.draw=function (){
this.createInfoBoxDiv_();
var pixPosition=this.getProjection().fromLatLngToDivPixel(this.position_);
this.div_.style.left=(pixPosition.x + this.pixelOffset_.width) + "px";
if(this.alignBottom_){
this.div_.style.bottom=-(pixPosition.y + this.pixelOffset_.height) + "px";
}else{
this.div_.style.top=(pixPosition.y + this.pixelOffset_.height) + "px";
}
if(this.isHidden_){
this.div_.style.visibility="hidden";
}else{
this.div_.style.visibility="visible";
}};
InfoBox.prototype.setOptions=function (opt_opts){
if(typeof opt_opts.boxClass!=="undefined"){
this.boxClass_=opt_opts.boxClass;
this.setBoxStyle_();
}
if(typeof opt_opts.boxStyle!=="undefined"){
this.boxStyle_=opt_opts.boxStyle;
this.setBoxStyle_();
}
if(typeof opt_opts.content!=="undefined"){
this.setContent(opt_opts.content);
}
if(typeof opt_opts.disableAutoPan!=="undefined"){
this.disableAutoPan_=opt_opts.disableAutoPan;
}
if(typeof opt_opts.maxWidth!=="undefined"){
this.maxWidth_=opt_opts.maxWidth;
}
if(typeof opt_opts.pixelOffset!=="undefined"){
this.pixelOffset_=opt_opts.pixelOffset;
}
if(typeof opt_opts.alignBottom!=="undefined"){
this.alignBottom_=opt_opts.alignBottom;
}
if(typeof opt_opts.position!=="undefined"){
this.setPosition(opt_opts.position);
}
if(typeof opt_opts.zIndex!=="undefined"){
this.setZIndex(opt_opts.zIndex);
}
if(typeof opt_opts.closeBoxMargin!=="undefined"){
this.closeBoxMargin_=opt_opts.closeBoxMargin;
}
if(typeof opt_opts.closeBoxURL!=="undefined"){
this.closeBoxURL_=opt_opts.closeBoxURL;
}
if(typeof opt_opts.infoBoxClearance!=="undefined"){
this.infoBoxClearance_=opt_opts.infoBoxClearance;
}
if(typeof opt_opts.isHidden!=="undefined"){
this.isHidden_=opt_opts.isHidden;
}
if(typeof opt_opts.visible!=="undefined"){
this.isHidden_ = !opt_opts.visible;
}
if(typeof opt_opts.enableEventPropagation!=="undefined"){
this.enableEventPropagation_=opt_opts.enableEventPropagation;
}
if(this.div_){
this.draw();
}};
InfoBox.prototype.setContent=function (content){
this.content_=content;
if(this.div_){
if(this.closeListener_){
google.maps.event.removeListener(this.closeListener_);
this.closeListener_=null;
}
if(!this.fixedWidthSet_){
this.div_.style.width="";
}
if(typeof content.nodeType==="undefined"){
this.div_.innerHTML=this.getCloseBoxImg_() + content;
}else{
this.div_.innerHTML=this.getCloseBoxImg_();
this.div_.appendChild(content);
}
if(!this.fixedWidthSet_){
this.div_.style.width=this.div_.offsetWidth + "px";
if(typeof content.nodeType==="undefined"){
this.div_.innerHTML=this.getCloseBoxImg_() + content;
}else{
this.div_.innerHTML=this.getCloseBoxImg_();
this.div_.appendChild(content);
}}
this.addClickHandler_();
}
google.maps.event.trigger(this, "content_changed");
};
InfoBox.prototype.setPosition=function (latlng){
this.position_=latlng;
if(this.div_){
this.draw();
}
google.maps.event.trigger(this, "position_changed");
};
InfoBox.prototype.setZIndex=function (index){
this.zIndex_=index;
if(this.div_){
this.div_.style.zIndex=index;
}
google.maps.event.trigger(this, "zindex_changed");
};
InfoBox.prototype.setVisible=function (isVisible){
this.isHidden_ = !isVisible;
if(this.div_){
this.div_.style.visibility=(this.isHidden_ ? "hidden":"visible");
}};
InfoBox.prototype.getContent=function (){
return this.content_;
};
InfoBox.prototype.getPosition=function (){
return this.position_;
};
InfoBox.prototype.getZIndex=function (){
return this.zIndex_;
};
InfoBox.prototype.getVisible=function (){
var isVisible;
if((typeof this.getMap()==="undefined")||(this.getMap()===null)){
isVisible=false;
}else{
isVisible = !this.isHidden_;
}
return isVisible;
};
InfoBox.prototype.show=function (){
this.isHidden_=false;
if(this.div_){
this.div_.style.visibility="visible";
}};
InfoBox.prototype.hide=function (){
this.isHidden_=true;
if(this.div_){
this.div_.style.visibility="hidden";
}};
InfoBox.prototype.open=function (map, anchor){
var me=this;
if(anchor){
this.position_=anchor.getPosition();
this.moveListener_=google.maps.event.addListener(anchor, "position_changed", function (){
me.setPosition(this.getPosition());
});
}
this.setMap(map);
if(this.div_){
this.panBox_();
}};
InfoBox.prototype.close=function (){
var i;
if(this.closeListener_){
google.maps.event.removeListener(this.closeListener_);
this.closeListener_=null;
}
if(this.eventListeners_){
for (i=0; i < this.eventListeners_.length; i++){
google.maps.event.removeListener(this.eventListeners_[i]);
}
this.eventListeners_=null;
}
if(this.moveListener_){
google.maps.event.removeListener(this.moveListener_);
this.moveListener_=null;
}
if(this.contextListener_){
google.maps.event.removeListener(this.contextListener_);
this.contextListener_=null;
}
this.setMap(null);
};
var width,height;
width=jQuery(window).width();
height=jQuery(window).height();
jQuery(window).resize(function(){
"use strict";
if(jQuery(window).width()!=width){
jQuery('#mobile_menu').hide('10');
}});
Number.prototype.format=function(n, x){
var re='\\d(?=(\\d{' + (x||3) + '})+' + (n > 0 ? '\\.':'$') + ')';
return this.toFixed(Math.max(0, ~~n)).replace(new RegExp(re, 'g'), '$&'+control_vars.price_separator);
};
jQuery(document).ready(function ($){
"use strict";
var screen_width,screen_height;
$('.list_sidebar_currency li').click(function(){
var ajaxurl,data,pos,symbol,coef,curpos;
data=$(this).attr('data-value');
pos=$(this).attr('data-pos');
symbol=$(this).attr('data-symbol');
coef=$(this).attr('data-coef');
curpos=$(this).attr('data-curpos');
ajaxurl=ajaxcalls_vars.admin_url + 'admin-ajax.php';
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_set_cookie_multiple_curr',
'curr':data,
'pos':pos,
'symbol':symbol,
'coef':coef,
'curpos':curpos,
},
success: function (data){
location.reload();
},
error: function (errorThrown){}});
});
$('#map-view').click(function(event){
$('.map-type').fadeIn(400);
});
$('.map-type').click(function(){
var map_type;
$('.map-type').hide();
map_type=$(this).attr('id');
});
if(typeof enable_half_map_pin_action=='function'){
enable_half_map_pin_action();
}
$('#pack_select').change(function(){
var stripe_pack_id,stripe_ammount,the_pick;
$("#pack_select option:selected").each(function(){
stripe_pack_id=$(this).val();
stripe_ammount=parseFloat($(this).attr('data-price'))*100;
the_pick=$(this).attr('data-pick');
});
$('#pack_id').val(stripe_pack_id);
$('#pay_ammout').val(stripe_ammount);
$('#stripe_form').attr('data-amount',stripe_ammount);
$('.stripe_buttons').each(function(){
$(this).hide();
if($(this).attr('id')===the_pick){
$(this).show();
}})
});
$('#pack_recuring').click(function (){
if($(this).attr('checked')){
$('#stripe_form').append('');
}else{
$('#stripe_recuring').remove();
}});
$('.front_plan_row').click(function(event){
event.preventDefault();
$('.front_plan_row_image').slideUp();
$(this).next().slideDown();
})
$('.deleter_floor').click(function(){
$(this).parent().remove();
})
$('#adv_extended_options_text_adv ').click(function(){
$('.adv-search-1.adv_extended_class').css('height','auto');
$('.adv_extended_class .adv1-holder').css('height','auto');
$(this).parent().find('.adv_extended_options_text').hide();
$(this).parent().find('.extended_search_check_wrapper').slideDown();
$(this).parent().find('#adv_extended_close_adv').show();
});
$('#adv_extended_close_adv').click(function(){
$(this).parent().parent().find('.extended_search_check_wrapper').slideUp();
$(this).hide();
$(this).parent().parent().find('.adv_extended_options_text').show();
$('.adv-search-1.adv_extended_class').removeAttr('style');
$('.adv_extended_class .adv1-holder').removeAttr('style');
});
$('#adv_extended_options_text_widget').click(function(){
$(this).parent().find('.adv_extended_options_text').hide();
$(this).parent().find('.extended_search_check_wrapper').slideDown();
$(this).parent().find('#adv_extended_close_widget').show();
});
$('#adv_extended_close_widget').click(function(){
$(this).parent().parent().find('.extended_search_check_wrapper').slideUp();
$(this).hide();
$(this).parent().parent().find('.adv_extended_options_text').show();
});
$('#adv_extended_options_text_short').click(function(){
$(this).parent().find('.adv_extended_options_text').hide();
$(this).parent().find('.extended_search_check_wrapper').slideDown();
$(this).parent().find('#adv_extended_close_short').show();
});
$('#adv_extended_close_short').click(function(){
$(this).parent().parent().find('.extended_search_check_wrapper').slideUp();
$(this).hide();
$(this).parent().parent().find('.adv_extended_options_text').show();
});
$('#adv_extended_options_text_mobile').click(function(){
$(this).parent().find('.adv_extended_options_text').hide();
$(this).parent().find('.extended_search_check_wrapper').slideDown();
$(this).parent().find('#adv_extended_close_mobile').show();
});
$('#adv_extended_close_mobile').click(function(){
$(this).parent().parent().find('.extended_search_check_wrapper').slideUp();
$(this).hide();
$(this).parent().parent().find('.adv_extended_options_text').show();
});
$('.nav-prev,.nav-next ').click(function(event){
event.preventDefault();
var link=$(this).find('a').attr('href');
window.open (link,'_self',false)
})
$('.featured_agent_details_wrapper, .agent-listing-img-wrapper').click(function(){
var newl=$(this).attr('data-link');
window.open (newl,'_self',false)
});
$('.see_my_list_featured').click(function(event){
event.stopPropagation();
});
$('.featured_cover').click(function(){
var newl=$(this).attr('data-link');
window.open (newl,'_self',false)
});
$('.agent_face').hover(function(){
$(this).find('.agent_face_details').fadeIn('500')
}, function(){
$(this).find('.agent_face_details').fadeOut('500')
}
);
$('.property_listing, .agent_unit, .blog_unit , .featured_widget_image').click(function(){
var link;
link=$(this).attr('data-link');
window.open(link, '_self');
});
$('.share_unit').click(function(event){
event.stopPropagation();
});
$('.related_blog_unit_image').click(function(){
var link;
link=$(this).attr('data-related-link');
window.open(link, '_self');
});
$('#user_menu_u').click(function(event){
if($('#user_menu_open').is(":visible")){
$('#user_menu_open').removeClass('iosfixed').fadeOut(400);
}else{
$('#user_menu_open').fadeIn(400);
}
event.stopPropagation();
});
$(document).click(function(event){
var clicka=event.target.id
if(!$('#'+clicka).parents('.topmenux').length){
$('#user_menu_open').removeClass('iosfixed').hide(400);
}});
jQuery('#imagelist i.fa-trash-o').click(function(){
var curent='';
jQuery(this).parent().remove();
jQuery('#imagelist .uploaded_images').each(function(){
curent=curent+','+jQuery(this).attr('data-imageid');
});
jQuery('#attachid').val(curent);
});
jQuery('#imagelist img').dblclick(function(){
jQuery('#imagelist .uploaded_images .thumber').each(function(){
jQuery(this).remove();
});
jQuery(this).parent().append('')
jQuery('#attachthumb').val(jQuery(this).parent().attr('data-imageid'));
});
$('#switch').click(function (){
$('.main_wrapper').toggleClass('wide');
});
$('#accordion_prop_addr, #accordion_prop_details, #accordion_prop_features').on('shown.bs.collapse', function (){
$(this).find('h4').removeClass('carusel_closed');
})
$('#accordion_prop_addr, #accordion_prop_details, #accordion_prop_features').on('hidden.bs.collapse', function (){
$(this).find('h4').addClass('carusel_closed');
})
var elems=['#adv-search-3', '#adv-search-1', '#advanced_search_shortcode', '#adv-search-2', '#advanced_search_shortcode_2', '.adv-search-mobile','.advanced_search_sidebar'];
$.each(elems, function(i, elem){
$(elem+' li').click(function (event){
event.preventDefault();
var pick, value, parent,parent_replace;
parent_replace='.filter_menu_trigger';
if(elem==='.advanced_search_sidebar'){
parent_replace='.sidebar_filter_menu';
}
pick=$(this).text();
value=$(this).attr('data-value');
parent=$(this).parent().parent();
parent.find(parent_replace).text(pick).append('').attr('data-value',value);
parent.find('input').val(value);
});
});
jQuery('#adv-search-1 li, #adv-search-3 li, .halfsearch input[type="checkbox"]').click(function (){
if(typeof (show_pins)!=="undefined"){
first_time_wpestate_show_inpage_ajax_half=1
show_pins();
}});
jQuery('#adv_rooms, #adv_bath, #price_low, #price_max, #adv-search-1 input[type=text], #adv-search-3 input[type=text]').change(function (){
if(typeof (show_pins)!=="undefined"){
first_time_wpestate_show_inpage_ajax_half=1
show_pins();
}});
function isFunction(possibleFunction){
return typeof(possibleFunction)===typeof(Function);
}
$('#showinpage,#showinpage_mobile').click(function (event){
event.preventDefault();
wpestate_show_inpage_ajax();
});
function wpestate_show_inpage_ajax(){
if($('#gmap-full').hasClass('spanselected')){
$('#gmap-full').trigger('click');
}
if(mapfunctions_vars.custom_search==='yes'){
custom_search_start_filtering_ajax(1);
}else{
start_filtering_ajax(1);
}}
$('#openmap').click(function(){
if($(this).find('i').hasClass('fa-angle-down')){
$(this).empty().append(''+control_vars.close_map);
if(control_vars.show_adv_search_map_close==='no'){
$('.search_wrapper').addClass('adv1_close');
adv_search_click();
}}else{
$(this).empty().append(''+control_vars.open_map);
}
new_open_close_map(2);
});
var wrap_h;
var map_h;
$('#gmap-full').click(function(){
if($('#gmap_wrapper').hasClass('fullmap')){
$('#google_map_prop_list_wrapper').removeClass('fullhalf');
$('#gmap_wrapper').removeClass('fullmap').css('height',wrap_h+'px');
$('#googleMap').removeClass('fullmap').css('height',map_h+'px');
$('#search_wrapper').removeClass('fullscreen_search');
$('#search_wrapper').removeClass('fullscreen_search_open');
$('.nav_wrapper').removeClass('hidden');
if(!$('#google_map_prop_list_wrapper').length){
$('.content_wrapper').show();
}
$('body,html').animate({
scrollTop: 0
}, "slow");
$('#openmap').show();
$(this).empty().append(''+control_vars.fullscreen).removeClass('spanselected');
$('#google_map_prop_list_wrapper').removeClass('fullscreen');
$('#google_map_prop_list_sidebar').removeClass('fullscreen');
}else{
$('#google_map_prop_list_wrapper').addClass('fullscreen');
$('#google_map_prop_list_sidebar').addClass('fullscreen');
$('#google_map_prop_list_wrapper').addClass('fullhalf');
wrap_h=$('#gmap_wrapper').outerHeight();
map_h=$('#googleMap').outerHeight();
$('#gmap_wrapper,#googleMap').css('height','100%').addClass('fullmap');
$('#search_wrapper').addClass('fullscreen_search');
$('.nav_wrapper').addClass('hidden');
if(!$('#google_map_prop_list_wrapper').length){
$('.content_wrapper').hide();
}
$('#openmap').hide();
$(this).empty().append(''+control_vars.default).addClass('spanselected');
}
google.maps.event.trigger(map, "resize");
});
$('#street-view').click(function(){
toggleStreetView();
});
$('#slider_enable_map').click(function(){
var cur_lat, cur_long, myLatLng;
$('#carousel-listing div').removeClass('slideron');
$('.vertical-wrapper,.verticalstatus ').hide();
$(this).addClass('slideron');
$('#googleMapSlider').show();
google.maps.event.trigger(map, "resize");
map.setOptions({draggable: true});
cur_lat=jQuery('#googleMapSlider').attr('data-cur_lat');
cur_long=jQuery('#googleMapSlider').attr('data-cur_long');
myLatLng=new google.maps.LatLng(cur_lat,cur_long);
map.setCenter(myLatLng);
map.panBy(10,-100);
panorama.setVisible(false);
$('#gmapzoomminus.smallslidecontrol').show();
$('#gmapzoomplus.smallslidecontrol').show();
});
$('#slider_enable_street').click(function(){
var cur_lat, cur_long, myLatLng;
$('#carousel-listing div').removeClass('slideron');
$('.vertical-wrapper,.verticalstatus ').hide();
$(this).addClass('slideron');
cur_lat=jQuery('#googleMapSlider').attr('data-cur_lat');
cur_long=jQuery('#googleMapSlider').attr('data-cur_long');
myLatLng=new google.maps.LatLng(cur_lat,cur_long);
$('#googleMapSlider').show();
panorama.setPosition(myLatLng);
panorama.setVisible(true);
$('#gmapzoomminus.smallslidecontrol').hide();
$('#gmapzoomplus.smallslidecontrol').hide();
});
$('#slider_enable_slider').click(function(){
$('#carousel-listing div').removeClass('slideron');
$(this).addClass('slideron');
$('.vertical-wrapper,.verticalstatus ').show();
$('#googleMapSlider').hide();
panorama.setVisible(false);
$('#gmapzoomminus.smallslidecontrol').hide();
$('#gmapzoomplus.smallslidecontrol').hide();
});
$('.caption-wrapper').click(function(){
$(this).toggleClass('closed');
$('.carusel-back').toggleClass('rowclosed');
$('.post-carusel .carousel-indicators').toggleClass('rowclosed');
});
$('#carousel-listing').on('slid.bs.carousel', function (){
if($(this).hasClass('carouselvertical')){
show_capture_vertical();
}else{
show_capture();
}
$('#carousel-listing div').removeClass('slideron');
$('#slider_enable_slider').addClass('slideron');
})
$('.carousel-round-indicators li').click(function(){
$('.carousel-round-indicators li').removeClass('active');
$(this).addClass('active');
});
$('.videoitem iframe').click(function(){
$('.estate_video_control').remove();
});
adv_search_click();
$('#adv-search-header-1').click(function(){
if(document.getElementById("adv_extended_options_text_adv")!==null){
$(this).parent().toggleClass('adv-search-1-close-extended');
}else{
$(this).parent().toggleClass('adv-search-1-close');
}});
$('#adv-search-header-3').click(function(){
$(this).parent().parent().toggleClass(' search_wrapper-close-extended');
});
$(".share_list, .icon-fav, .compare-action, .dashboad-tooltip").hover(function(){
$(this).tooltip('show') ;
}, function(){
$(this).tooltip('hide');
}
);
$('.share_list').click(function(event){
event.stopPropagation();
var sharediv=$(this).parent().find('.share_unit');
sharediv.toggle();
$(this).toggleClass('share_on');
})
$('.backtop').click(function(event){
event.preventDefault();
$('body,html').animate({
scrollTop: 0
}, "slow");
})
$('.contact-box ').click(function(event){
event.preventDefault();
$('.contactformwrapper').toggleClass('hidden');
contact_footer_starter();
});
$('#morg_compute').click(function(){
var intPayPer=0;
var intMthPay=0;
var intMthInt=0;
var intPerFin=0;
var intAmtFin=0;
var intIntRate=0;
var intAnnCost=0;
var intVal=0;
var salePrice=0;
salePrice=$('#sale_price').val();
intPerFin=$('#percent_down').val() / 100;
intAmtFin=salePrice - salePrice * intPerFin;
intPayPer=parseInt ($('#term_years').val(),10) * 12;
intIntRate=parseFloat ($('#interest_rate').val(),10);
intMthInt=intIntRate / (12 * 100);
intVal=raisePower(1 + intMthInt, -intPayPer);
intMthPay=intAmtFin * (intMthInt / (1 - intVal));
intAnnCost=intMthPay * 12;
$('#am_fin').html(""+control_vars.morg1+"
" + (Math.round(intAmtFin * 100)) / 100 + " ");
$('#morgage_pay').html(""+control_vars.morg2+"
" + (Math.round(intMthPay * 100)) / 100 + " ");
$('#anual_pay').html(""+control_vars.morg3+"
" + (Math.round(intAnnCost * 100)) / 100 + " ");
$('#morg_results').show();
$('.mortgage_calculator_div').css('height',532+'px');
});
$("#geolocation-button").hover(function (){
$('#tooltip-geolocation').fadeIn();
$('.tooltip').fadeOut("fast");
},
function (){
$('#tooltip-geolocation').fadeOut();
}
);
$('.extra_featured').change(function(){
var parent=$(this).parent();
var price_regular=parseFloat(parent.find('.submit-price-no').text(),10);
var price_featured=parseFloat(parent.find('.submit-price-featured').text(),10);
var total=price_regular+price_featured;
if($(this).is(':checked')){
parent.find('.submit-price-total').text(total);
parent.find('#stripe_form_featured').show();
parent.find('#stripe_form_simple').hide();
}else{
parent.find('.submit-price-total').text(price_regular);
parent.find('#stripe_form_featured').hide();
parent.find('#stripe_form_simple').show();
}});
$('.compare_wrapper').each(function(){
var cols=$(this).find('.compare_item_head').length;
$(this).addClass('compar-' + cols);
});
$('#list_view').click(function(){
$(this).toggleClass('icon_selected');
$('#listing_ajax_container').addClass('ajax12');
$('#grid_view').toggleClass('icon_selected');
$('.listing_wrapper').hide().removeClass('col-md-4').removeClass('col-md-3').addClass('col-md-12').fadeIn(400) ;
$('.the_grid_view').fadeOut(10,function(){
$('.the_list_view').fadeIn(300);
});
})
$('#grid_view').click(function(){
var class_type;
class_type=$('.listing_wrapper:first-of-type').attr('data-org');
$(this).toggleClass('icon_selected');
$('#listing_ajax_container').removeClass('ajax12');
$('#list_view').toggleClass('icon_selected');
$('.listing_wrapper ').hide().removeClass('col-md-12').addClass('col-md-'+class_type).fadeIn(400);
$('.the_list_view').fadeOut(10,function(){
$('.the_grid_view').fadeIn(300);
});
})
var already_in=[];
$('.compare-action').click(function(e){
e.preventDefault();
e.stopPropagation();
$('.prop-compare').show();
var post_id=$(this).attr('data-pid');
for(var i=0; i < already_in.length; i++){
if(already_in[i]===post_id){
return;
}}
already_in.push(post_id);
var post_image=$(this).attr('data-pimage');
var to_add='
';
$('div.items_compare:first-child').css('background', 'red');
if(parseInt($('.items_compare').length,10) > 3){
$('.items_compare:first').remove();
}
$('#submit_compare').before(to_add);
$('#submit_compare').click(function(){
$('#form_compare').trigger('submit');
})
$('.items_compare').fadeIn(500);
});
$('#submit_compare').click(function(){
$('#form_compare').trigger('submit');
})
$('#form_submit_2,#form_submit_1 ').click(function(){
var loading_modal;
window.scrollTo(0, 0);
loading_modal='';
jQuery('body').append(loading_modal);
jQuery('#loadingmodal').modal();
});
$('#add-new-image').click(function(){
$(' ').appendTo('#files_area');
})
$('.delete_image').click(function(){
var image_id=$(this).attr('data-imageid');
var curent=$('#images_todelete').val();
if(curent===''){
curent=image_id;
}else{
curent=curent+','+image_id;
}
$('#images_todelete').val(curent) ;
$(this).parent().remove();
});
$('#googleMap').bind('mousemove', function(e){
$('.tooltip').css({'top':e.pageY,'left':e.pageX, 'z-index':'1'});
});
setTimeout(function(){ $('.tooltip').fadeOut("fast");},10000);
});
function wpestate_filter_city_area(selected_city,selected_area){
jQuery('#'+selected_city+' li').click(function(event){
event.preventDefault();
var pick, value_city, parent, selected_city, is_city, area_value;
value_city=String(jQuery(this).attr('data-value2')).toLowerCase();
jQuery('#'+selected_area+' li').each(function(){
is_city=String(jQuery(this).attr('data-parentcity')).toLowerCase();
is_city=is_city.replace(" ","-");
area_value=String(jQuery(this).attr('data-value')).toLowerCase();
if(is_city===value_city||value_city==='all'){
jQuery(this).show();
}else{
jQuery(this).hide();
}});
});
}
function show_capture_vertical(){
"use strict";
var position, slideno, slidedif, tomove, curentleft, position;
jQuery('#googleMapSlider').hide();
position=parseInt(jQuery('#carousel-listing .carousel-inner .active').index(),10);
jQuery('#carousel-indicators-vertical li').removeClass('active');
jQuery('#carousel-listing .caption-wrapper span').removeClass('active');
jQuery("#carousel-listing .caption-wrapper span[data-slide-to='"+position+"'] ").addClass('active');
jQuery("#carousel-listing .caption-wrapper span[data-slide-to='"+position+"'] ").addClass('active');
jQuery("#carousel-indicators-vertical li[data-slide-to='"+position+"'] ").addClass('active');
slideno=position+1;
slidedif=slideno*84;
if(slidedif > 336){
tomove=336-slidedif;
tomove=tomove;
jQuery('#carousel-indicators-vertical').css('top',tomove+"px");
}else{
position=jQuery('#carousel-indicators-vertical').css('top',tomove+"px").position();
curentleft=position.top;
if(curentleft < 0){
tomove=0;
jQuery('#carousel-indicators-vertical').css('top',tomove+"px");
}}
}
function show_capture(){
"use strict";
var position, slideno, slidedif, tomove, curentleft, position;
jQuery('#googleMapSlider').hide();
position=parseInt(jQuery('#carousel-listing .carousel-inner .active').index(),10);
jQuery('#carousel-listing .caption-wrapper span').removeClass('active');
jQuery('#carousel-listing .carousel-round-indicators li').removeClass('active');
jQuery("#carousel-listing .caption-wrapper span[data-slide-to='"+position+"'] ").addClass('active');
jQuery("#carousel-listing .carousel-round-indicators li[data-slide-to='"+position+"'] ").addClass('active');
slideno=position+1;
slidedif=slideno*146;
if(slidedif > 810){
tomove=810-slidedif;
jQuery('.post-carusel .carousel-indicators').css('left',tomove+"px");
}else{
position=jQuery('.post-carusel .carousel-indicators').css('left',tomove+"px").position();
curentleft=position.left;
if(curentleft < 0){
tomove=0;
jQuery('.post-carusel .carousel-indicators').css('left',tomove+"px");
}}
}
function raisePower(x, y){
return Math.pow(x, y);
}
function shortcode_google_map_load(containermap, lat, long, mapid){
"use strict";
var myCenter=new google.maps.LatLng(lat, long);
var mapOptions={
flat:false,
noClear:false,
zoom: 15,
scrollwheel: false,
draggable: true,
center: myCenter,
mapTypeId: google.maps.MapTypeId.ROADMAP,
streetViewControl:false,
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.ROADMAP]
},
disableDefaultUI: true
};
map=new google.maps.Map(document.getElementById(mapid), mapOptions);
google.maps.visualRefresh=true;
var marker=new google.maps.Marker({
position: myCenter,
map: map
});
marker.setMap(map);
}
function adv_search_click(){
jQuery('#adv-search-header-1').click(function(){
jQuery('#search_wrapper').toggleClass('fullscreen_search_open');
});
}
function contact_footer_starter(){
jQuery('#btn-cont-submit').click(function (){
var contact_name, contact_email, contact_phone, contact_coment, agent_email, property_id, nonce, ajaxurl;
contact_name=jQuery('#foot_contact_name').val();
contact_email=jQuery('#foot_contact_email').val();
contact_phone=jQuery('#foot_contact_phone').val();
contact_coment=jQuery('#foot_contact_content').val();
agent_email=jQuery('#foot_agent_email').val();
nonce=jQuery('#contact_footer_ajax_nonce').val();
ajaxurl=ajaxcalls_vars.admin_url + 'admin-ajax.php';
jQuery.ajax({
type: 'POST',
dataType: 'json',
url: ajaxurl,
data: {
'action':'wpestate_ajax_contact_form_footer',
'name':contact_name,
'email':contact_email,
'phone':contact_phone,
'contact_coment':contact_coment,
'agentemail': agent_email,
'propid':property_id,
'nonce':nonce
},
success: function (data){
if(data.sent){
jQuery('#foot_contact_name').val('');
jQuery('#foot_contact_email').val('');
jQuery('#foot_contact_phone').val('');
jQuery('#foot_contact_content').val('');
}
jQuery('#footer_alert-agent-contact').empty().append(data.response);
},
error: function (errorThrown){
}});
});
}
function filter_invoices(){
"use strict";
var ajaxurl, start_date, end_date, type, status;
start_date=jQuery('#invoice_start_date').val();
end_date=jQuery('#invoice_end_date').val();
type=jQuery('#invoice_type').val();
status=jQuery('#invoice_status').val();
ajaxurl=ajaxcalls_vars.admin_url + 'admin-ajax.php';
jQuery.ajax({
type: 'POST',
url: ajaxurl,
dataType: 'json',
data: {
'action':'wpestate_ajax_filter_invoices',
'start_date':start_date,
'end_date':end_date,
'type':type,
'status':status
},
success: function (data){
jQuery('#container-invoices').empty().append(data.results);
jQuery('#invoice_confirmed').empty().append(data.invoice_confirmed);
},
error: function (errorThrown){
}});
};
;
window.Modernizr=(function(window, document, undefined){
var version='2.6.2',
Modernizr={},
enableClasses=true,
docElement=document.documentElement,
mod='modernizr',
modElem=document.createElement(mod),
mStyle=modElem.style,
inputElem=document.createElement('input') ,
smile=':)',
toString={}.toString,
prefixes=' -webkit- -moz- -o- -ms- '.split(' '),
omPrefixes='Webkit Moz O ms',
cssomPrefixes=omPrefixes.split(' '),
domPrefixes=omPrefixes.toLowerCase().split(' '),
ns={'svg': 'http://www.w3.org/2000/svg'},
tests={},
inputs={},
attrs={},
classes=[],
slice=classes.slice,
featureName,
injectElementWithStyles=function(rule, callback, nodes, testnames){
var style, ret, node, docOverflow,
div=document.createElement('div'),
body=document.body,
fakeBody=body||document.createElement('body');
if(parseInt(nodes, 10)){
while(nodes--){
node=document.createElement('div');
node.id=testnames ? testnames[nodes]:mod + (nodes + 1);
div.appendChild(node);
}}
style=['',''].join('');
div.id=mod;
(body ? div:fakeBody).innerHTML +=style;
fakeBody.appendChild(div);
if(!body){
fakeBody.style.background='';
fakeBody.style.overflow='hidden';
docOverflow=docElement.style.overflow;
docElement.style.overflow='hidden';
docElement.appendChild(fakeBody);
}
ret=callback(div, rule);
if(!body){
fakeBody.parentNode.removeChild(fakeBody);
docElement.style.overflow=docOverflow;
}else{
div.parentNode.removeChild(div);
}
return !!ret;
},
testMediaQuery=function(mq){
var matchMedia=window.matchMedia||window.msMatchMedia;
if(matchMedia){
return matchMedia(mq).matches;
}
var bool;
injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; }}', function(node){
bool=(window.getComputedStyle ?
getComputedStyle(node, null) :
node.currentStyle)['position']=='absolute';
});
return bool;
},
isEventSupported=(function(){
var TAGNAMES={
'select': 'input', 'change': 'input',
'submit': 'form', 'reset': 'form',
'error': 'img', 'load': 'img', 'abort': 'img'
};
function isEventSupported(eventName, element){
element=element||document.createElement(TAGNAMES[eventName]||'div');
eventName='on' + eventName;
var isSupported=eventName in element;
if(!isSupported){
if(!element.setAttribute){
element=document.createElement('div');
}
if(element.setAttribute&&element.removeAttribute){
element.setAttribute(eventName, '');
isSupported=is(element[eventName], 'function');
if(!is(element[eventName], 'undefined')){
element[eventName]=undefined;
}
element.removeAttribute(eventName);
}}
element=null;
return isSupported;
}
return isEventSupported;
})(),
_hasOwnProperty=({}).hasOwnProperty, hasOwnProp;
if(!is(_hasOwnProperty, 'undefined')&&!is(_hasOwnProperty.call, 'undefined')){
hasOwnProp=function (object, property){
return _hasOwnProperty.call(object, property);
};}else{
hasOwnProp=function (object, property){
return ((property in object)&&is(object.constructor.prototype[property], 'undefined'));
};}
if(!Function.prototype.bind){
Function.prototype.bind=function bind(that){
var target=this;
if(typeof target!="function"){
throw new TypeError();
}
var args=slice.call(arguments, 1),
bound=function (){
if(this instanceof bound){
var F=function(){};
F.prototype=target.prototype;
var self=new F();
var result=target.apply(self,
args.concat(slice.call(arguments))
);
if(Object(result)===result){
return result;
}
return self;
}else{
return target.apply(that,
args.concat(slice.call(arguments))
);
}};
return bound;
};}
function setCss(str){
mStyle.cssText=str;
}
function setCssAll(str1, str2){
return setCss(prefixes.join(str1 + ';') +(str2||''));
}
function is(obj, type){
return typeof obj===type;
}
function contains(str, substr){
return !!~('' + str).indexOf(substr);
}
function testProps(props, prefixed){
for(var i in props){
var prop=props[i];
if(!contains(prop, "-")&&mStyle[prop]!==undefined){
return prefixed=='pfx' ? prop:true;
}}
return false;
}
function testDOMProps(props, obj, elem){
for(var i in props){
var item=obj[props[i]];
if(item!==undefined){
if(elem===false) return props[i];
if(is(item, 'function')){
return item.bind(elem||obj);
}
return item;
}}
return false;
}
function testPropsAll(prop, prefixed, elem){
var ucProp=prop.charAt(0).toUpperCase() + prop.slice(1),
props=(prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');
if(is(prefixed, "string")||is(prefixed, "undefined")){
return testProps(props, prefixed);
}else{
props=(prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
return testDOMProps(props, prefixed, elem);
}} tests['flexbox']=function(){
return testPropsAll('flexWrap');
}; tests['canvas']=function(){
var elem=document.createElement('canvas');
return !!(elem.getContext&&elem.getContext('2d'));
};
tests['canvastext']=function(){
return !!(Modernizr['canvas']&&is(document.createElement('canvas').getContext('2d').fillText, 'function'));
};
tests['webgl']=function(){
return !!window.WebGLRenderingContext;
};
tests['touch']=function(){
var bool;
if(('ontouchstart' in window)||window.DocumentTouch&&document instanceof DocumentTouch){
bool=true;
}else{
injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function(node){
bool=node.offsetTop===9;
});
}
return bool;
};
tests['geolocation']=function(){
return 'geolocation' in navigator;
};
tests['postmessage']=function(){
return !!window.postMessage;
};
tests['websqldatabase']=function(){
return !!window.openDatabase;
};
tests['indexedDB']=function(){
return !!testPropsAll("indexedDB", window);
};
tests['hashchange']=function(){
return isEventSupported('hashchange', window)&&(document.documentMode===undefined||document.documentMode > 7);
};
tests['history']=function(){
return !!(window.history&&history.pushState);
};
tests['draganddrop']=function(){
var div=document.createElement('div');
return ('draggable' in div)||('ondragstart' in div&&'ondrop' in div);
};
tests['websockets']=function(){
return 'WebSocket' in window||'MozWebSocket' in window;
};
tests['rgba']=function(){
setCss('background-color:rgba(150,255,150,.5)');
return contains(mStyle.backgroundColor, 'rgba');
};
tests['hsla']=function(){
setCss('background-color:hsla(120,40%,100%,.5)');
return contains(mStyle.backgroundColor, 'rgba')||contains(mStyle.backgroundColor, 'hsla');
};
tests['multiplebgs']=function(){
setCss('background:url(https://),url(https://),red url(https://)');
return (/(url\s*\(.*?){3}/).test(mStyle.background);
}; tests['backgroundsize']=function(){
return testPropsAll('backgroundSize');
};
tests['borderimage']=function(){
return testPropsAll('borderImage');
};
tests['borderradius']=function(){
return testPropsAll('borderRadius');
};
tests['boxshadow']=function(){
return testPropsAll('boxShadow');
};
tests['textshadow']=function(){
return document.createElement('div').style.textShadow==='';
};
tests['opacity']=function(){
setCssAll('opacity:.55');
return (/^0.55$/).test(mStyle.opacity);
};
tests['cssanimations']=function(){
return testPropsAll('animationName');
};
tests['csscolumns']=function(){
return testPropsAll('columnCount');
};
tests['cssgradients']=function(){
var str1='background-image:',
str2='gradient(linear,left top,right bottom,from(#9f9),to(white));',
str3='linear-gradient(left top,#9f9, white);';
setCss(
(str1 + '-webkit- '.split(' ').join(str2 + str1) +
prefixes.join(str3 + str1)).slice(0, -str1.length)
);
return contains(mStyle.backgroundImage, 'gradient');
};
tests['cssreflections']=function(){
return testPropsAll('boxReflect');
};
tests['csstransforms']=function(){
return !!testPropsAll('transform');
};
tests['csstransforms3d']=function(){
var ret = !!testPropsAll('perspective');
if(ret&&'webkitPerspective' in docElement.style){
injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function(node, rule){
ret=node.offsetLeft===9&&node.offsetHeight===3;
});
}
return ret;
};
tests['csstransitions']=function(){
return testPropsAll('transition');
};
tests['fontface']=function(){
var bool;
injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function(node, rule){
var style=document.getElementById('smodernizr'),
sheet=style.sheet||style.styleSheet,
cssText=sheet ? (sheet.cssRules&&sheet.cssRules[0] ? sheet.cssRules[0].cssText:sheet.cssText||''):'';
bool=/src/i.test(cssText)&&cssText.indexOf(rule.split(' ')[0])===0;
});
return bool;
};
tests['generatedcontent']=function(){
var bool;
injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function(node){
bool=node.offsetHeight >=3;
});
return bool;
};
tests['video']=function(){
var elem=document.createElement('video'),
bool=false;
try {
if(bool = !!elem.canPlayType){
bool=new Boolean(bool);
bool.ogg=elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,'');
bool.h264=elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
bool.webm=elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
}} catch(e){ }
return bool;
};
tests['audio']=function(){
var elem=document.createElement('audio'),
bool=false;
try {
if(bool = !!elem.canPlayType){
bool=new Boolean(bool);
bool.ogg=elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
bool.mp3=elem.canPlayType('audio/mpeg;') .replace(/^no$/,'');
bool.wav=elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,'');
bool.m4a=(elem.canPlayType('audio/x-m4a;') ||
elem.canPlayType('audio/aac;')) .replace(/^no$/,'');
}} catch(e){ }
return bool;
};
tests['localstorage']=function(){
try {
localStorage.setItem(mod, mod);
localStorage.removeItem(mod);
return true;
} catch(e){
return false;
}};
tests['sessionstorage']=function(){
try {
sessionStorage.setItem(mod, mod);
sessionStorage.removeItem(mod);
return true;
} catch(e){
return false;
}};
tests['webworkers']=function(){
return !!window.Worker;
};
tests['applicationcache']=function(){
return !!window.applicationCache;
};
tests['svg']=function(){
return !!document.createElementNS&&!!document.createElementNS(ns.svg, 'svg').createSVGRect;
};
tests['inlinesvg']=function(){
var div=document.createElement('div');
div.innerHTML='';
return (div.firstChild&&div.firstChild.namespaceURI)==ns.svg;
};
tests['smil']=function(){
return !!document.createElementNS&&/SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate')));
};
tests['svgclippaths']=function(){
return !!document.createElementNS&&/SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath')));
};
function webforms(){
Modernizr['input']=(function(props){
for(var i=0, len=props.length; i < len; i++){
attrs[ props[i] ] = !!(props[i] in inputElem);
}
if(attrs.list){
attrs.list = !!(document.createElement('datalist')&&window.HTMLDataListElement);
}
return attrs;
})('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));
Modernizr['inputtypes']=(function(props){
for(var i=0, bool, inputElemType, defaultView, len=props.length; i < len; i++){
inputElem.setAttribute('type', inputElemType=props[i]);
bool=inputElem.type!=='text';
if(bool){
inputElem.value=smile;
inputElem.style.cssText='position:absolute;visibility:hidden;';
if(/^range$/.test(inputElemType)&&inputElem.style.WebkitAppearance!==undefined){
docElement.appendChild(inputElem);
defaultView=document.defaultView;
bool=defaultView.getComputedStyle &&
defaultView.getComputedStyle(inputElem, null).WebkitAppearance!=='textfield' &&
(inputElem.offsetHeight!==0);
docElement.removeChild(inputElem);
}else if(/^(search|tel)$/.test(inputElemType)){
}else if(/^(url|email)$/.test(inputElemType)){
bool=inputElem.checkValidity&&inputElem.checkValidity()===false;
}else{
bool=inputElem.value!=smile;
}}
inputs[ props[i] ] = !!bool;
}
return inputs;
})('search tel url email datetime date month week time datetime-local number range color'.split(' '));
}
for(var feature in tests){
if(hasOwnProp(tests, feature)){
featureName=feature.toLowerCase();
Modernizr[featureName]=tests[feature]();
classes.push((Modernizr[featureName] ? '':'no-') + featureName);
}}
Modernizr.input||webforms();
Modernizr.addTest=function(feature, test){
if(typeof feature=='object'){
for(var key in feature){
if(hasOwnProp(feature, key)){
Modernizr.addTest(key, feature[ key ]);
}}
}else{
feature=feature.toLowerCase();
if(Modernizr[feature]!==undefined){
return Modernizr;
}
test=typeof test=='function' ? test():test;
if(typeof enableClasses!=="undefined"&&enableClasses){
docElement.className +=' ' + (test ? '':'no-') + feature;
}
Modernizr[feature]=test;
}
return Modernizr;
};
setCss('');
modElem=inputElem=null;
;(function(window, document){
var options=window.html5||{};
var reSkip=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
var saveClones=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
var supportsHtml5Styles;
var expando='_html5shiv';
var expanID=0;
var expandoData={};
var supportsUnknownElements;
(function(){
try {
var a=document.createElement('a');
a.innerHTML='';
supportsHtml5Styles=('hidden' in a);
supportsUnknownElements=a.childNodes.length==1||(function(){
(document.createElement)('a');
var frag=document.createDocumentFragment();
return (
typeof frag.cloneNode=='undefined' ||
typeof frag.createDocumentFragment=='undefined' ||
typeof frag.createElement=='undefined'
);
}());
} catch(e){
supportsHtml5Styles=true;
supportsUnknownElements=true;
}}()); function addStyleSheet(ownerDocument, cssText){
var p=ownerDocument.createElement('p'),
parent=ownerDocument.getElementsByTagName('head')[0]||ownerDocument.documentElement;
p.innerHTML='x';
return parent.insertBefore(p.lastChild, parent.firstChild);
}
function getElements(){
var elements=html5.elements;
return typeof elements=='string' ? elements.split(' '):elements;
}
function getExpandoData(ownerDocument){
var data=expandoData[ownerDocument[expando]];
if(!data){
data={};
expanID++;
ownerDocument[expando]=expanID;
expandoData[expanID]=data;
}
return data;
}
function createElement(nodeName, ownerDocument, data){
if(!ownerDocument){
ownerDocument=document;
}
if(supportsUnknownElements){
return ownerDocument.createElement(nodeName);
}
if(!data){
data=getExpandoData(ownerDocument);
}
var node;
if(data.cache[nodeName]){
node=data.cache[nodeName].cloneNode();
}else if(saveClones.test(nodeName)){
node=(data.cache[nodeName]=data.createElem(nodeName)).cloneNode();
}else{
node=data.createElem(nodeName);
}
return node.canHaveChildren&&!reSkip.test(nodeName) ? data.frag.appendChild(node):node;
}
function createDocumentFragment(ownerDocument, data){
if(!ownerDocument){
ownerDocument=document;
}
if(supportsUnknownElements){
return ownerDocument.createDocumentFragment();
}
data=data||getExpandoData(ownerDocument);
var clone=data.frag.cloneNode(),
i=0,
elems=getElements(),
l=elems.length;
for(;i (this.$items.length - 1)||pos < 0) return
if(this.sliding) return this.$element.one('slid.bs.carousel', function (){ that.to(pos) })
if(activeIndex==pos) return this.pause().cycle()
return this.slide(pos > activeIndex ? 'next':'prev', this.$items.eq(pos))
}
Carousel.prototype.pause=function (e){
e||(this.paused=true)
if(this.$element.find('.next, .prev').length&&$.support.transition){
this.$element.trigger($.support.transition.end)
this.cycle(true)
}
this.interval=clearInterval(this.interval)
return this
}
Carousel.prototype.next=function (){
if(this.sliding) return
return this.slide('next')
}
Carousel.prototype.prev=function (){
if(this.sliding) return
return this.slide('prev')
}
Carousel.prototype.slide=function (type, next){
var $active=this.$element.find('.item.active')
var $next=next||this.getItemForDirection(type, $active)
var isCycling=this.interval
var direction=type=='next' ? 'left':'right'
var that=this
if($next.hasClass('active')) return (this.sliding=false)
var relatedTarget=$next[0]
var slideEvent=$.Event('slide.bs.carousel', {
relatedTarget: relatedTarget,
direction: direction
})
this.$element.trigger(slideEvent)
if(slideEvent.isDefaultPrevented()) return
this.sliding=true
isCycling&&this.pause()
if(this.$indicators.length){
this.$indicators.find('.active').removeClass('active')
var $nextIndicator=$(this.$indicators.children()[this.getItemIndex($next)])
$nextIndicator&&$nextIndicator.addClass('active')
}
var slidEvent=$.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction })
if($.support.transition&&this.$element.hasClass('slide')){
$next.addClass(type)
$next[0].offsetWidth
$active.addClass(direction)
$next.addClass(direction)
$active
.one('bsTransitionEnd', function (){
$next.removeClass([type, direction].join(' ')).addClass('active')
$active.removeClass(['active', direction].join(' '))
that.sliding=false
setTimeout(function (){
that.$element.trigger(slidEvent)
}, 0)
})
.emulateTransitionEnd(Carousel.TRANSITION_DURATION)
}else{
$active.removeClass('active')
$next.addClass('active')
this.sliding=false
this.$element.trigger(slidEvent)
}
isCycling&&this.cycle()
return this
}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.carousel')
var options=$.extend({}, Carousel.DEFAULTS, $this.data(), typeof option=='object'&&option)
var action=typeof option=='string' ? option:options.slide
if(!data) $this.data('bs.carousel', (data=new Carousel(this, options)))
if(typeof option=='number') data.to(option)
else if(action) data[action]()
else if(options.interval) data.pause().cycle()
})
}
var old=$.fn.carousel
$.fn.carousel=Plugin
$.fn.carousel.Constructor=Carousel
$.fn.carousel.noConflict=function (){
$.fn.carousel=old
return this
}
var clickHandler=function (e){
var href
var $this=$(this)
var $target=$($this.attr('data-target')||(href=$this.attr('href'))&&href.replace(/.*(?=#[^\s]+$)/, ''))
if(!$target.hasClass('carousel')) return
var options=$.extend({}, $target.data(), $this.data())
var slideIndex=$this.attr('data-slide-to')
if(slideIndex) options.interval=false
Plugin.call($target, options)
if(slideIndex){
$target.data('bs.carousel').to(slideIndex)
}
e.preventDefault()
}
$(document)
.on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
.on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
$(window).on('load', function (){
$('[data-ride="carousel"]').each(function (){
var $carousel=$(this)
Plugin.call($carousel, $carousel.data())
})
})
}(jQuery);
+function ($){
'use strict';
var Collapse=function (element, options){
this.$element=$(element)
this.options=$.extend({}, Collapse.DEFAULTS, options)
this.$trigger=$('[data-toggle="collapse"][href="#' + element.id + '"],' +
'[data-toggle="collapse"][data-target="#' + element.id + '"]')
this.transitioning=null
if(this.options.parent){
this.$parent=this.getParent()
}else{
this.addAriaAndCollapsedClass(this.$element, this.$trigger)
}
if(this.options.toggle) this.toggle()
}
Collapse.VERSION='3.3.4'
Collapse.TRANSITION_DURATION=350
Collapse.DEFAULTS={
toggle: true
}
Collapse.prototype.dimension=function (){
var hasWidth=this.$element.hasClass('width')
return hasWidth ? 'width':'height'
}
Collapse.prototype.show=function (){
if(this.transitioning||this.$element.hasClass('in')) return
var activesData
var actives=this.$parent&&this.$parent.children('.panel').children('.in, .collapsing')
if(actives&&actives.length){
activesData=actives.data('bs.collapse')
if(activesData&&activesData.transitioning) return
}
var startEvent=$.Event('show.bs.collapse')
this.$element.trigger(startEvent)
if(startEvent.isDefaultPrevented()) return
if(actives&&actives.length){
Plugin.call(actives, 'hide')
activesData||actives.data('bs.collapse', null)
}
var dimension=this.dimension()
this.$element
.removeClass('collapse')
.addClass('collapsing')[dimension](0)
.attr('aria-expanded', true)
this.$trigger
.removeClass('collapsed')
.attr('aria-expanded', true)
this.transitioning=1
var complete=function (){
this.$element
.removeClass('collapsing')
.addClass('collapse in')[dimension]('')
this.transitioning=0
this.$element
.trigger('shown.bs.collapse')
}
if(!$.support.transition) return complete.call(this)
var scrollSize=$.camelCase(['scroll', dimension].join('-'))
this.$element
.one('bsTransitionEnd', $.proxy(complete, this))
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
}
Collapse.prototype.hide=function (){
if(this.transitioning||!this.$element.hasClass('in')) return
var startEvent=$.Event('hide.bs.collapse')
this.$element.trigger(startEvent)
if(startEvent.isDefaultPrevented()) return
var dimension=this.dimension()
this.$element[dimension](this.$element[dimension]())[0].offsetHeight
this.$element
.addClass('collapsing')
.removeClass('collapse in')
.attr('aria-expanded', false)
this.$trigger
.addClass('collapsed')
.attr('aria-expanded', false)
this.transitioning=1
var complete=function (){
this.transitioning=0
this.$element
.removeClass('collapsing')
.addClass('collapse')
.trigger('hidden.bs.collapse')
}
if(!$.support.transition) return complete.call(this)
this.$element
[dimension](0)
.one('bsTransitionEnd', $.proxy(complete, this))
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)
}
Collapse.prototype.toggle=function (){
this[this.$element.hasClass('in') ? 'hide':'show']()
}
Collapse.prototype.getParent=function (){
return $(this.options.parent)
.find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
.each($.proxy(function (i, element){
var $element=$(element)
this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
}, this))
.end()
}
Collapse.prototype.addAriaAndCollapsedClass=function ($element, $trigger){
var isOpen=$element.hasClass('in')
$element.attr('aria-expanded', isOpen)
$trigger
.toggleClass('collapsed', !isOpen)
.attr('aria-expanded', isOpen)
}
function getTargetFromTrigger($trigger){
var href
var target=$trigger.attr('data-target')
|| (href=$trigger.attr('href'))&&href.replace(/.*(?=#[^\s]+$)/, '')
return $(target)
}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.collapse')
var options=$.extend({}, Collapse.DEFAULTS, $this.data(), typeof option=='object'&&option)
if(!data&&options.toggle&&/show|hide/.test(option)) options.toggle=false
if(!data) $this.data('bs.collapse', (data=new Collapse(this, options)))
if(typeof option=='string') data[option]()
})
}
var old=$.fn.collapse
$.fn.collapse=Plugin
$.fn.collapse.Constructor=Collapse
$.fn.collapse.noConflict=function (){
$.fn.collapse=old
return this
}
$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e){
var $this=$(this)
if(!$this.attr('data-target')) e.preventDefault()
var $target=getTargetFromTrigger($this)
var data=$target.data('bs.collapse')
var option=data ? 'toggle':$this.data()
Plugin.call($target, option)
})
}(jQuery);
+function ($){
'use strict';
var backdrop='.dropdown-backdrop'
var toggle='[data-toggle="dropdown"]'
var Dropdown=function (element){
$(element).on('click.bs.dropdown', this.toggle)
}
Dropdown.VERSION='3.3.4'
Dropdown.prototype.toggle=function (e){
var $this=$(this)
if($this.is('.disabled, :disabled')) return
var $parent=getParent($this)
var isActive=$parent.hasClass('open')
clearMenus()
if(!isActive){
if('ontouchstart' in document.documentElement&&!$parent.closest('.navbar-nav').length){
$('').insertAfter($(this)).on('click', clearMenus)
}
var relatedTarget={ relatedTarget: this }
$parent.trigger(e=$.Event('show.bs.dropdown', relatedTarget))
if(e.isDefaultPrevented()) return
$this
.trigger('focus')
.attr('aria-expanded', 'true')
$parent
.toggleClass('open')
.trigger('shown.bs.dropdown', relatedTarget)
}
return false
}
Dropdown.prototype.keydown=function (e){
if(!/(38|40|27|32)/.test(e.which)||/input|textarea/i.test(e.target.tagName)) return
var $this=$(this)
e.preventDefault()
e.stopPropagation()
if($this.is('.disabled, :disabled')) return
var $parent=getParent($this)
var isActive=$parent.hasClass('open')
if((!isActive&&e.which!=27)||(isActive&&e.which==27)){
if(e.which==27) $parent.find(toggle).trigger('focus')
return $this.trigger('click')
}
var desc=' li:not(.disabled):visible a'
var $items=$parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
if(!$items.length) return
var index=$items.index(e.target)
if(e.which==38&&index > 0) index--
if(e.which==40&&index < $items.length - 1) index++
if(!~index) index=0
$items.eq(index).trigger('focus')
}
function clearMenus(e){
if(e&&e.which===3) return
$(backdrop).remove()
$(toggle).each(function (){
var $this=$(this)
var $parent=getParent($this)
var relatedTarget={ relatedTarget: this }
if(!$parent.hasClass('open')) return
$parent.trigger(e=$.Event('hide.bs.dropdown', relatedTarget))
if(e.isDefaultPrevented()) return
$this.attr('aria-expanded', 'false')
$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
})
}
function getParent($this){
var selector=$this.attr('data-target')
if(!selector){
selector=$this.attr('href')
selector=selector&&/#[A-Za-z]/.test(selector)&&selector.replace(/.*(?=#[^\s]*$)/, '')
}
var $parent=selector&&$(selector)
return $parent&&$parent.length ? $parent:$this.parent()
}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.dropdown')
if(!data) $this.data('bs.dropdown', (data=new Dropdown(this)))
if(typeof option=='string') data[option].call($this)
})
}
var old=$.fn.dropdown
$.fn.dropdown=Plugin
$.fn.dropdown.Constructor=Dropdown
$.fn.dropdown.noConflict=function (){
$.fn.dropdown=old
return this
}
$(document)
.on('click.bs.dropdown.data-api', clearMenus)
.on('click.bs.dropdown.data-api', '.dropdown form', function (e){ e.stopPropagation() })
.on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
.on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
.on('keydown.bs.dropdown.data-api', '[role="menu"]', Dropdown.prototype.keydown)
.on('keydown.bs.dropdown.data-api', '[role="listbox"]', Dropdown.prototype.keydown)
}(jQuery);
+function ($){
'use strict';
var Modal=function (element, options){
this.options=options
this.$body=$(document.body)
this.$element=$(element)
this.$dialog=this.$element.find('.modal-dialog')
this.$backdrop=null
this.isShown=null
this.originalBodyPad=null
this.scrollbarWidth=0
this.ignoreBackdropClick=false
if(this.options.remote){
this.$element
.find('.modal-content')
.load(this.options.remote, $.proxy(function (){
this.$element.trigger('loaded.bs.modal')
}, this))
}}
Modal.VERSION='3.3.4'
Modal.TRANSITION_DURATION=300
Modal.BACKDROP_TRANSITION_DURATION=150
Modal.DEFAULTS={
backdrop: true,
keyboard: true,
show: true
}
Modal.prototype.toggle=function (_relatedTarget){
return this.isShown ? this.hide():this.show(_relatedTarget)
}
Modal.prototype.show=function (_relatedTarget){
var that=this
var e=$.Event('show.bs.modal', { relatedTarget: _relatedTarget })
this.$element.trigger(e)
if(this.isShown||e.isDefaultPrevented()) return
this.isShown=true
this.checkScrollbar()
this.setScrollbar()
this.$body.addClass('modal-open')
this.escape()
this.resize()
this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
this.$dialog.on('mousedown.dismiss.bs.modal', function (){
that.$element.one('mouseup.dismiss.bs.modal', function (e){
if($(e.target).is(that.$element)) that.ignoreBackdropClick=true
})
})
this.backdrop(function (){
var transition=$.support.transition&&that.$element.hasClass('fade')
if(!that.$element.parent().length){
that.$element.appendTo(that.$body)
}
that.$element
.show()
.scrollTop(0)
that.adjustDialog()
if(transition){
that.$element[0].offsetWidth
}
that.$element
.addClass('in')
.attr('aria-hidden', false)
that.enforceFocus()
var e=$.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
transition ?
that.$dialog
.one('bsTransitionEnd', function (){
that.$element.trigger('focus').trigger(e)
})
.emulateTransitionEnd(Modal.TRANSITION_DURATION) :
that.$element.trigger('focus').trigger(e)
})
}
Modal.prototype.hide=function (e){
if(e) e.preventDefault()
e=$.Event('hide.bs.modal')
this.$element.trigger(e)
if(!this.isShown||e.isDefaultPrevented()) return
this.isShown=false
this.escape()
this.resize()
$(document).off('focusin.bs.modal')
this.$element
.removeClass('in')
.attr('aria-hidden', true)
.off('click.dismiss.bs.modal')
.off('mouseup.dismiss.bs.modal')
this.$dialog.off('mousedown.dismiss.bs.modal')
$.support.transition&&this.$element.hasClass('fade') ?
this.$element
.one('bsTransitionEnd', $.proxy(this.hideModal, this))
.emulateTransitionEnd(Modal.TRANSITION_DURATION) :
this.hideModal()
}
Modal.prototype.enforceFocus=function (){
$(document)
.off('focusin.bs.modal')
.on('focusin.bs.modal', $.proxy(function (e){
if(this.$element[0]!==e.target&&!this.$element.has(e.target).length){
this.$element.trigger('focus')
}}, this))
}
Modal.prototype.escape=function (){
if(this.isShown&&this.options.keyboard){
this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e){
e.which==27&&this.hide()
}, this))
}else if(!this.isShown){
this.$element.off('keydown.dismiss.bs.modal')
}}
Modal.prototype.resize=function (){
if(this.isShown){
$(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
}else{
$(window).off('resize.bs.modal')
}}
Modal.prototype.hideModal=function (){
var that=this
this.$element.hide()
this.backdrop(function (){
that.$body.removeClass('modal-open')
that.resetAdjustments()
that.resetScrollbar()
that.$element.trigger('hidden.bs.modal')
})
}
Modal.prototype.removeBackdrop=function (){
this.$backdrop&&this.$backdrop.remove()
this.$backdrop=null
}
Modal.prototype.backdrop=function (callback){
var that=this
var animate=this.$element.hasClass('fade') ? 'fade':''
if(this.isShown&&this.options.backdrop){
var doAnimate=$.support.transition&&animate
this.$backdrop=$('')
.appendTo(this.$body)
this.$element.on('click.dismiss.bs.modal', $.proxy(function (e){
if(this.ignoreBackdropClick){
this.ignoreBackdropClick=false
return
}
if(e.target!==e.currentTarget) return
this.options.backdrop=='static'
? this.$element[0].focus()
: this.hide()
}, this))
if(doAnimate) this.$backdrop[0].offsetWidth
this.$backdrop.addClass('in')
if(!callback) return
doAnimate ?
this.$backdrop
.one('bsTransitionEnd', callback)
.emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
callback()
}else if(!this.isShown&&this.$backdrop){
this.$backdrop.removeClass('in')
var callbackRemove=function (){
that.removeBackdrop()
callback&&callback()
}
$.support.transition&&this.$element.hasClass('fade') ?
this.$backdrop
.one('bsTransitionEnd', callbackRemove)
.emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
callbackRemove()
}else if(callback){
callback()
}}
Modal.prototype.handleUpdate=function (){
this.adjustDialog()
}
Modal.prototype.adjustDialog=function (){
var modalIsOverflowing=this.$element[0].scrollHeight > document.documentElement.clientHeight
this.$element.css({
paddingLeft: !this.bodyIsOverflowing&&modalIsOverflowing ? this.scrollbarWidth:'',
paddingRight: this.bodyIsOverflowing&&!modalIsOverflowing ? this.scrollbarWidth:''
})
}
Modal.prototype.resetAdjustments=function (){
this.$element.css({
paddingLeft: '',
paddingRight: ''
})
}
Modal.prototype.checkScrollbar=function (){
var fullWindowWidth=window.innerWidth
if(!fullWindowWidth){
var documentElementRect=document.documentElement.getBoundingClientRect()
fullWindowWidth=documentElementRect.right - Math.abs(documentElementRect.left)
}
this.bodyIsOverflowing=document.body.clientWidth < fullWindowWidth
this.scrollbarWidth=this.measureScrollbar()
}
Modal.prototype.setScrollbar=function (){
var bodyPad=parseInt((this.$body.css('padding-right')||0), 10)
this.originalBodyPad=document.body.style.paddingRight||''
if(this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
}
Modal.prototype.resetScrollbar=function (){
this.$body.css('padding-right', this.originalBodyPad)
}
Modal.prototype.measureScrollbar=function (){
var scrollDiv=document.createElement('div')
scrollDiv.className='modal-scrollbar-measure'
this.$body.append(scrollDiv)
var scrollbarWidth=scrollDiv.offsetWidth - scrollDiv.clientWidth
this.$body[0].removeChild(scrollDiv)
return scrollbarWidth
}
function Plugin(option, _relatedTarget){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.modal')
var options=$.extend({}, Modal.DEFAULTS, $this.data(), typeof option=='object'&&option)
if(!data) $this.data('bs.modal', (data=new Modal(this, options)))
if(typeof option=='string') data[option](_relatedTarget)
else if(options.show) data.show(_relatedTarget)
})
}
var old=$.fn.modal
$.fn.modal=Plugin
$.fn.modal.Constructor=Modal
$.fn.modal.noConflict=function (){
$.fn.modal=old
return this
}
$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e){
var $this=$(this)
var href=$this.attr('href')
var $target=$($this.attr('data-target')||(href&&href.replace(/.*(?=#[^\s]+$)/, '')))
var option=$target.data('bs.modal') ? 'toggle':$.extend({ remote: !/#/.test(href)&&href }, $target.data(), $this.data())
if($this.is('a')) e.preventDefault()
$target.one('show.bs.modal', function (showEvent){
if(showEvent.isDefaultPrevented()) return
$target.one('hidden.bs.modal', function (){
$this.is(':visible')&&$this.trigger('focus')
})
})
Plugin.call($target, option, this)
})
}(jQuery);
+function ($){
'use strict';
var Tooltip=function (element, options){
this.type=null
this.options=null
this.enabled=null
this.timeout=null
this.hoverState=null
this.$element=null
this.init('tooltip', element, options)
}
Tooltip.VERSION='3.3.4'
Tooltip.TRANSITION_DURATION=150
Tooltip.DEFAULTS={
animation: true,
placement: 'top',
selector: false,
template: '',
trigger: 'hover focus',
title: '',
delay: 0,
html: false,
container: false,
viewport: {
selector: 'body',
padding: 0
}}
Tooltip.prototype.init=function (type, element, options){
this.enabled=true
this.type=type
this.$element=$(element)
this.options=this.getOptions(options)
this.$viewport=this.options.viewport&&$(this.options.viewport.selector||this.options.viewport)
if(this.$element[0] instanceof document.constructor&&!this.options.selector){
throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
}
var triggers=this.options.trigger.split(' ')
for (var i=triggers.length; i--;){
var trigger=triggers[i]
if(trigger=='click'){
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
}else if(trigger!='manual'){
var eventIn=trigger=='hover' ? 'mouseenter':'focusin'
var eventOut=trigger=='hover' ? 'mouseleave':'focusout'
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
}}
this.options.selector ?
(this._options=$.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle()
}
Tooltip.prototype.getDefaults=function (){
return Tooltip.DEFAULTS
}
Tooltip.prototype.getOptions=function (options){
options=$.extend({}, this.getDefaults(), this.$element.data(), options)
if(options.delay&&typeof options.delay=='number'){
options.delay={
show: options.delay,
hide: options.delay
}}
return options
}
Tooltip.prototype.getDelegateOptions=function (){
var options={}
var defaults=this.getDefaults()
this._options&&$.each(this._options, function (key, value){
if(defaults[key]!=value) options[key]=value
})
return options
}
Tooltip.prototype.enter=function (obj){
var self=obj instanceof this.constructor ?
obj:$(obj.currentTarget).data('bs.' + this.type)
if(self&&self.$tip&&self.$tip.is(':visible')){
self.hoverState='in'
return
}
if(!self){
self=new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
clearTimeout(self.timeout)
self.hoverState='in'
if(!self.options.delay||!self.options.delay.show) return self.show()
self.timeout=setTimeout(function (){
if(self.hoverState=='in') self.show()
}, self.options.delay.show)
}
Tooltip.prototype.leave=function (obj){
var self=obj instanceof this.constructor ?
obj:$(obj.currentTarget).data('bs.' + this.type)
if(!self){
self=new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
clearTimeout(self.timeout)
self.hoverState='out'
if(!self.options.delay||!self.options.delay.hide) return self.hide()
self.timeout=setTimeout(function (){
if(self.hoverState=='out') self.hide()
}, self.options.delay.hide)
}
Tooltip.prototype.show=function (){
var e=$.Event('show.bs.' + this.type)
if(this.hasContent()&&this.enabled){
this.$element.trigger(e)
var inDom=$.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
if(e.isDefaultPrevented()||!inDom) return
var that=this
var $tip=this.tip()
var tipId=this.getUID(this.type)
this.setContent()
$tip.attr('id', tipId)
this.$element.attr('aria-describedby', tipId)
if(this.options.animation) $tip.addClass('fade')
var placement=typeof this.options.placement=='function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement
var autoToken=/\s?auto?\s?/i
var autoPlace=autoToken.test(placement)
if(autoPlace) placement=placement.replace(autoToken, '')||'top'
$tip
.detach()
.css({ top: 0, left: 0, display: 'block' })
.addClass(placement)
.data('bs.' + this.type, this)
this.options.container ? $tip.appendTo(this.options.container):$tip.insertAfter(this.$element)
var pos=this.getPosition()
var actualWidth=$tip[0].offsetWidth
var actualHeight=$tip[0].offsetHeight
if(autoPlace){
var orgPlacement=placement
var $container=this.options.container ? $(this.options.container):this.$element.parent()
var containerDim=this.getPosition($container)
placement=placement=='bottom'&&pos.bottom + actualHeight > containerDim.bottom ? 'top' :
placement=='top'&&pos.top - actualHeight < containerDim.top ? 'bottom' :
placement=='right'&&pos.right + actualWidth > containerDim.width ? 'left' :
placement=='left'&&pos.left - actualWidth < containerDim.left ? 'right' :
placement
$tip
.removeClass(orgPlacement)
.addClass(placement)
}
var calculatedOffset=this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
this.applyPlacement(calculatedOffset, placement)
var complete=function (){
var prevHoverState=that.hoverState
that.$element.trigger('shown.bs.' + that.type)
that.hoverState=null
if(prevHoverState=='out') that.leave(that)
}
$.support.transition&&this.$tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
complete()
}}
Tooltip.prototype.applyPlacement=function (offset, placement){
var $tip=this.tip()
var width=$tip[0].offsetWidth
var height=$tip[0].offsetHeight
var marginTop=parseInt($tip.css('margin-top'), 10)
var marginLeft=parseInt($tip.css('margin-left'), 10)
if(isNaN(marginTop)) marginTop=0
if(isNaN(marginLeft)) marginLeft=0
offset.top=offset.top + marginTop
offset.left=offset.left + marginLeft
$.offset.setOffset($tip[0], $.extend({
using: function (props){
$tip.css({
top: Math.round(props.top),
left: Math.round(props.left)
})
}}, offset), 0)
$tip.addClass('in')
var actualWidth=$tip[0].offsetWidth
var actualHeight=$tip[0].offsetHeight
if(placement=='top'&&actualHeight!=height){
offset.top=offset.top + height - actualHeight
}
var delta=this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
if(delta.left) offset.left +=delta.left
else offset.top +=delta.top
var isVertical=/top|bottom/.test(placement)
var arrowDelta=isVertical ? delta.left * 2 - width + actualWidth:delta.top * 2 - height + actualHeight
var arrowOffsetPosition=isVertical ? 'offsetWidth':'offsetHeight'
$tip.offset(offset)
this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
}
Tooltip.prototype.replaceArrow=function (delta, dimension, isVertical){
this.arrow()
.css(isVertical ? 'left':'top', 50 * (1 - delta / dimension) + '%')
.css(isVertical ? 'top':'left', '')
}
Tooltip.prototype.setContent=function (){
var $tip=this.tip()
var title=this.getTitle()
$tip.find('.tooltip-inner')[this.options.html ? 'html':'text'](title)
$tip.removeClass('fade in top bottom left right')
}
Tooltip.prototype.hide=function (callback){
var that=this
var $tip=$(this.$tip)
var e=$.Event('hide.bs.' + this.type)
function complete(){
if(that.hoverState!='in') $tip.detach()
that.$element
.removeAttr('aria-describedby')
.trigger('hidden.bs.' + that.type)
callback&&callback()
}
this.$element.trigger(e)
if(e.isDefaultPrevented()) return
$tip.removeClass('in')
$.support.transition&&$tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
complete()
this.hoverState=null
return this
}
Tooltip.prototype.fixTitle=function (){
var $e=this.$element
if($e.attr('title')||typeof ($e.attr('data-original-title'))!='string'){
$e.attr('data-original-title', $e.attr('title')||'').attr('title', '')
}}
Tooltip.prototype.hasContent=function (){
return this.getTitle()
}
Tooltip.prototype.getPosition=function ($element){
$element=$element||this.$element
var el=$element[0]
var isBody=el.tagName=='BODY'
var elRect=el.getBoundingClientRect()
if(elRect.width==null){
elRect=$.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
}
var elOffset=isBody ? { top: 0, left: 0 }:$element.offset()
var scroll={ scroll: isBody ? document.documentElement.scrollTop||document.body.scrollTop:$element.scrollTop() }
var outerDims=isBody ? { width: $(window).width(), height: $(window).height() }:null
return $.extend({}, elRect, scroll, outerDims, elOffset)
}
Tooltip.prototype.getCalculatedOffset=function (placement, pos, actualWidth, actualHeight){
return placement=='bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement=='top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement=='left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
{ top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }}
Tooltip.prototype.getViewportAdjustedDelta=function (placement, pos, actualWidth, actualHeight){
var delta={ top: 0, left: 0 }
if(!this.$viewport) return delta
var viewportPadding=this.options.viewport&&this.options.viewport.padding||0
var viewportDimensions=this.getPosition(this.$viewport)
if(/right|left/.test(placement)){
var topEdgeOffset=pos.top - viewportPadding - viewportDimensions.scroll
var bottomEdgeOffset=pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
if(topEdgeOffset < viewportDimensions.top){
delta.top=viewportDimensions.top - topEdgeOffset
}else if(bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height){
delta.top=viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
}}else{
var leftEdgeOffset=pos.left - viewportPadding
var rightEdgeOffset=pos.left + viewportPadding + actualWidth
if(leftEdgeOffset < viewportDimensions.left){
delta.left=viewportDimensions.left - leftEdgeOffset
}else if(rightEdgeOffset > viewportDimensions.width){
delta.left=viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
}}
return delta
}
Tooltip.prototype.getTitle=function (){
var title
var $e=this.$element
var o=this.options
title=$e.attr('data-original-title')
|| (typeof o.title=='function' ? o.title.call($e[0]):o.title)
return title
}
Tooltip.prototype.getUID=function (prefix){
do prefix +=~~(Math.random() * 1000000)
while (document.getElementById(prefix))
return prefix
}
Tooltip.prototype.tip=function (){
return (this.$tip=this.$tip||$(this.options.template))
}
Tooltip.prototype.arrow=function (){
return (this.$arrow=this.$arrow||this.tip().find('.tooltip-arrow'))
}
Tooltip.prototype.enable=function (){
this.enabled=true
}
Tooltip.prototype.disable=function (){
this.enabled=false
}
Tooltip.prototype.toggleEnabled=function (){
this.enabled = !this.enabled
}
Tooltip.prototype.toggle=function (e){
var self=this
if(e){
self=$(e.currentTarget).data('bs.' + this.type)
if(!self){
self=new this.constructor(e.currentTarget, this.getDelegateOptions())
$(e.currentTarget).data('bs.' + this.type, self)
}}
self.tip().hasClass('in') ? self.leave(self):self.enter(self)
}
Tooltip.prototype.destroy=function (){
var that=this
clearTimeout(this.timeout)
this.hide(function (){
that.$element.off('.' + that.type).removeData('bs.' + that.type)
})
}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.tooltip')
var options=typeof option=='object'&&option
if(!data&&/destroy|hide/.test(option)) return
if(!data) $this.data('bs.tooltip', (data=new Tooltip(this, options)))
if(typeof option=='string') data[option]()
})
}
var old=$.fn.tooltip
$.fn.tooltip=Plugin
$.fn.tooltip.Constructor=Tooltip
$.fn.tooltip.noConflict=function (){
$.fn.tooltip=old
return this
}}(jQuery);
+function ($){
'use strict';
var Popover=function (element, options){
this.init('popover', element, options)
}
if(!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
Popover.VERSION='3.3.4'
Popover.DEFAULTS=$.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
placement: 'right',
trigger: 'click',
content: '',
template: ''
})
Popover.prototype=$.extend({}, $.fn.tooltip.Constructor.prototype)
Popover.prototype.constructor=Popover
Popover.prototype.getDefaults=function (){
return Popover.DEFAULTS
}
Popover.prototype.setContent=function (){
var $tip=this.tip()
var title=this.getTitle()
var content=this.getContent()
$tip.find('.popover-title')[this.options.html ? 'html':'text'](title)
$tip.find('.popover-content').children().detach().end()[
this.options.html ? (typeof content=='string' ? 'html':'append'):'text'
](content)
$tip.removeClass('fade top bottom left right in')
if(!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
}
Popover.prototype.hasContent=function (){
return this.getTitle()||this.getContent()
}
Popover.prototype.getContent=function (){
var $e=this.$element
var o=this.options
return $e.attr('data-content')
|| (typeof o.content=='function' ?
o.content.call($e[0]) :
o.content)
}
Popover.prototype.arrow=function (){
return (this.$arrow=this.$arrow||this.tip().find('.arrow'))
}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.popover')
var options=typeof option=='object'&&option
if(!data&&/destroy|hide/.test(option)) return
if(!data) $this.data('bs.popover', (data=new Popover(this, options)))
if(typeof option=='string') data[option]()
})
}
var old=$.fn.popover
$.fn.popover=Plugin
$.fn.popover.Constructor=Popover
$.fn.popover.noConflict=function (){
$.fn.popover=old
return this
}}(jQuery);
+function ($){
'use strict';
function ScrollSpy(element, options){
this.$body=$(document.body)
this.$scrollElement=$(element).is(document.body) ? $(window):$(element)
this.options=$.extend({}, ScrollSpy.DEFAULTS, options)
this.selector=(this.options.target||'') + ' .nav li > a'
this.offsets=[]
this.targets=[]
this.activeTarget=null
this.scrollHeight=0
this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
this.refresh()
this.process()
}
ScrollSpy.VERSION='3.3.4'
ScrollSpy.DEFAULTS={
offset: 10
}
ScrollSpy.prototype.getScrollHeight=function (){
return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
}
ScrollSpy.prototype.refresh=function (){
var that=this
var offsetMethod='offset'
var offsetBase=0
this.offsets=[]
this.targets=[]
this.scrollHeight=this.getScrollHeight()
if(!$.isWindow(this.$scrollElement[0])){
offsetMethod='position'
offsetBase=this.$scrollElement.scrollTop()
}
this.$body
.find(this.selector)
.map(function (){
var $el=$(this)
var href=$el.data('target')||$el.attr('href')
var $href=/^#./.test(href)&&$(href)
return ($href
&& $href.length
&& $href.is(':visible')
&& [[$href[offsetMethod]().top + offsetBase, href]])||null
})
.sort(function (a, b){ return a[0] - b[0] })
.each(function (){
that.offsets.push(this[0])
that.targets.push(this[1])
})
}
ScrollSpy.prototype.process=function (){
var scrollTop=this.$scrollElement.scrollTop() + this.options.offset
var scrollHeight=this.getScrollHeight()
var maxScroll=this.options.offset + scrollHeight - this.$scrollElement.height()
var offsets=this.offsets
var targets=this.targets
var activeTarget=this.activeTarget
var i
if(this.scrollHeight!=scrollHeight){
this.refresh()
}
if(scrollTop >=maxScroll){
return activeTarget!=(i=targets[targets.length - 1])&&this.activate(i)
}
if(activeTarget&&scrollTop < offsets[0]){
this.activeTarget=null
return this.clear()
}
for (i=offsets.length; i--;){
activeTarget!=targets[i]
&& scrollTop >=offsets[i]
&& (offsets[i + 1]===undefined||scrollTop < offsets[i + 1])
&& this.activate(targets[i])
}}
ScrollSpy.prototype.activate=function (target){
this.activeTarget=target
this.clear()
var selector=this.selector +
'[data-target="' + target + '"],' +
this.selector + '[href="' + target + '"]'
var active=$(selector)
.parents('li')
.addClass('active')
if(active.parent('.dropdown-menu').length){
active=active
.closest('li.dropdown')
.addClass('active')
}
active.trigger('activate.bs.scrollspy')
}
ScrollSpy.prototype.clear=function (){
$(this.selector)
.parentsUntil(this.options.target, '.active')
.removeClass('active')
}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.scrollspy')
var options=typeof option=='object'&&option
if(!data) $this.data('bs.scrollspy', (data=new ScrollSpy(this, options)))
if(typeof option=='string') data[option]()
})
}
var old=$.fn.scrollspy
$.fn.scrollspy=Plugin
$.fn.scrollspy.Constructor=ScrollSpy
$.fn.scrollspy.noConflict=function (){
$.fn.scrollspy=old
return this
}
$(window).on('load.bs.scrollspy.data-api', function (){
$('[data-spy="scroll"]').each(function (){
var $spy=$(this)
Plugin.call($spy, $spy.data())
})
})
}(jQuery);
+function ($){
'use strict';
var Tab=function (element){
this.element=$(element)
}
Tab.VERSION='3.3.4'
Tab.TRANSITION_DURATION=150
Tab.prototype.show=function (){
var $this=this.element
var $ul=$this.closest('ul:not(.dropdown-menu)')
var selector=$this.data('target')
if(!selector){
selector=$this.attr('href')
selector=selector&&selector.replace(/.*(?=#[^\s]*$)/, '')
}
if($this.parent('li').hasClass('active')) return
var $previous=$ul.find('.active:last a')
var hideEvent=$.Event('hide.bs.tab', {
relatedTarget: $this[0]
})
var showEvent=$.Event('show.bs.tab', {
relatedTarget: $previous[0]
})
$previous.trigger(hideEvent)
$this.trigger(showEvent)
if(showEvent.isDefaultPrevented()||hideEvent.isDefaultPrevented()) return
var $target=$(selector)
this.activate($this.closest('li'), $ul)
this.activate($target, $target.parent(), function (){
$previous.trigger({
type: 'hidden.bs.tab',
relatedTarget: $this[0]
})
$this.trigger({
type: 'shown.bs.tab',
relatedTarget: $previous[0]
})
})
}
Tab.prototype.activate=function (element, container, callback){
var $active=container.find('> .active')
var transition=callback
&& $.support.transition
&& (($active.length&&$active.hasClass('fade'))||!!container.find('> .fade').length)
function next(){
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', false)
element
.addClass('active')
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
if(transition){
element[0].offsetWidth
element.addClass('in')
}else{
element.removeClass('fade')
}
if(element.parent('.dropdown-menu').length){
element
.closest('li.dropdown')
.addClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
}
callback&&callback()
}
$active.length&&transition ?
$active
.one('bsTransitionEnd', next)
.emulateTransitionEnd(Tab.TRANSITION_DURATION) :
next()
$active.removeClass('in')
}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.tab')
if(!data) $this.data('bs.tab', (data=new Tab(this)))
if(typeof option=='string') data[option]()
})
}
var old=$.fn.tab
$.fn.tab=Plugin
$.fn.tab.Constructor=Tab
$.fn.tab.noConflict=function (){
$.fn.tab=old
return this
}
var clickHandler=function (e){
e.preventDefault()
Plugin.call($(this), 'show')
}
$(document)
.on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
.on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
}(jQuery);
+function ($){
'use strict';
var Affix=function (element, options){
this.options=$.extend({}, Affix.DEFAULTS, options)
this.$target=$(this.options.target)
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
this.$element=$(element)
this.affixed=null
this.unpin=null
this.pinnedOffset=null
this.checkPosition()
}
Affix.VERSION='3.3.4'
Affix.RESET='affix affix-top affix-bottom'
Affix.DEFAULTS={
offset: 0,
target: window
}
Affix.prototype.getState=function (scrollHeight, height, offsetTop, offsetBottom){
var scrollTop=this.$target.scrollTop()
var position=this.$element.offset()
var targetHeight=this.$target.height()
if(offsetTop!=null&&this.affixed=='top') return scrollTop < offsetTop ? 'top':false
if(this.affixed=='bottom'){
if(offsetTop!=null) return (scrollTop + this.unpin <=position.top) ? false:'bottom'
return (scrollTop + targetHeight <=scrollHeight - offsetBottom) ? false:'bottom'
}
var initializing=this.affixed==null
var colliderTop=initializing ? scrollTop:position.top
var colliderHeight=initializing ? targetHeight:height
if(offsetTop!=null&&scrollTop <=offsetTop) return 'top'
if(offsetBottom!=null&&(colliderTop + colliderHeight >=scrollHeight - offsetBottom)) return 'bottom'
return false
}
Affix.prototype.getPinnedOffset=function (){
if(this.pinnedOffset) return this.pinnedOffset
this.$element.removeClass(Affix.RESET).addClass('affix')
var scrollTop=this.$target.scrollTop()
var position=this.$element.offset()
return (this.pinnedOffset=position.top - scrollTop)
}
Affix.prototype.checkPositionWithEventLoop=function (){
setTimeout($.proxy(this.checkPosition, this), 1)
}
Affix.prototype.checkPosition=function (){
if(!this.$element.is(':visible')) return
var height=this.$element.height()
var offset=this.options.offset
var offsetTop=offset.top
var offsetBottom=offset.bottom
var scrollHeight=$(document.body).height()
if(typeof offset!='object') offsetBottom=offsetTop=offset
if(typeof offsetTop=='function') offsetTop=offset.top(this.$element)
if(typeof offsetBottom=='function') offsetBottom=offset.bottom(this.$element)
var affix=this.getState(scrollHeight, height, offsetTop, offsetBottom)
if(this.affixed!=affix){
if(this.unpin!=null) this.$element.css('top', '')
var affixType='affix' + (affix ? '-' + affix:'')
var e=$.Event(affixType + '.bs.affix')
this.$element.trigger(e)
if(e.isDefaultPrevented()) return
this.affixed=affix
this.unpin=affix=='bottom' ? this.getPinnedOffset():null
this.$element
.removeClass(Affix.RESET)
.addClass(affixType)
.trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
}
if(affix=='bottom'){
this.$element.offset({
top: scrollHeight - height - offsetBottom
})
}}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.affix')
var options=typeof option=='object'&&option
if(!data) $this.data('bs.affix', (data=new Affix(this, options)))
if(typeof option=='string') data[option]()
})
}
var old=$.fn.affix
$.fn.affix=Plugin
$.fn.affix.Constructor=Affix
$.fn.affix.noConflict=function (){
$.fn.affix=old
return this
}
$(window).on('load', function (){
$('[data-spy="affix"]').each(function (){
var $spy=$(this)
var data=$spy.data()
data.offset=data.offset||{}
if(data.offsetBottom!=null) data.offset.bottom=data.offsetBottom
if(data.offsetTop!=null) data.offset.top=data.offsetTop
Plugin.call($spy, data)
})
})
}(jQuery);